var e = require;
var t = module;
var o = exports;
var n;
function i(e, t) {
    return (i =
        Object.setPrototypeOf ||
        function (e, t) {
            return (e.__proto__ = t), e;
        })(e, t);
}
(o.__esModule = !0), (o.default = void 0);
var a = (function (e) {
    var t, o;
    function n() {
        return e.call(this) || this;
    }
    (o = e), ((t = n).prototype = Object.create(o.prototype)), (t.prototype.constructor = t), i(t, o);
    var a = n.prototype;
    return (
        (a.init = function () {
            (this.env = window.gamebox),
                (this.info = (window.lplatform && lplatform.systemInfo) || this.env.getSystemInfoSync()),
                (this.bh = lplatform.cparam.bannerHeight || 170),
                (this.bw = lplatform.cparam.bannerWidth || Math.min(this.info.windowWidth, (16 * this.bh) / 9)),
                gamebox.login();
        }),
        (a.initAD = function () {
            this.loadBanner(!1), this.loadInterstitial(!1), this.createRewardedVideo(!1);
        }),
        (a.loadBanner = function (e) {
            this.hideBanner(!0),
                this.bannerAd ||
                    ((this.btop = 0),
                    lplatform.cparam.bannerOnBottom && (this.btop = this.info.windowHeight - this.bh),
                    lplatform.plog("loadBanner this.bh:" + this.bh + " this.btop:" + this.btop + " this.bw:" + this.bw),
                    (this.bannerAd = this.env.createBannerAd({
                        style: {
                            width: this.bw,
                            height: this.bh,
                            left: (this.info.windowWidth - this.bw) / 2,
                            top: this.btop
                        }
                    })),
                    this.bannerAd.onLoad(this.onBannerLoad.bind(this)),
                    this.bannerAd.onError(this.onBannerError.bind(this))),
                (this.bannerAutoShow = e);
        }),
        (a.loadInterstitial = function (e) {
            this.hideInterstitial(),
                this.insterstitialAd
                    ? this.insterstitialAd.load()
                    : ((this.insterstitialAd = this.env.createInterstitialAd()),
                      this.insterstitialAd.onLoad(this.onInterstitialLoad.bind(this)),
                      this.insterstitialAd.onError(this.onInterstitialError.bind(this)),
                      this.insterstitialAd.onClose(this.onInterstitialClose.bind(this))),
                e && this.showInterstitial();
        }),
        (a.createRewardedVideo = function (e) {
            lplatform.cparam.rewardedVideoID &&
                (this.rewardedVideoAd ||
                    "function" != typeof this.env.createRewardedVideoAd ||
                    ((this.rewardedVideoAd = this.env.createRewardedVideoAd()),
                    this.rewardedVideoAd.onError(this.onRewardedVideoError.bind(this)),
                    this.rewardedVideoAd.onClose(this.onRewardedVideoClose.bind(this)),
                    this.rewardedVideoAd.onLoad(this.onRewardedVideoLoad.bind(this))),
                e && this.showRewardedVideo(window.vcb));
        }),
        (a.shareAppMessage = function () {
            this.env.shareMessageToFriend({
                type: 1,
                success: function success() {},
                fail: function fail() {},
                complete: function complete() {}
            });
        }),
        (a.makeShareUI = function (e, t, o, n, i) {
            void 0 === n && (n = 0),
                void 0 === i && (i = !1),
                lplatform.uiEngine.CreateShareK(
                    function () {
                        this.shareRecord(e, t);
                    }.bind(this),
                    function () {
                        t && t(), this.gameRecordShareBtn && this.gameRecordShareBtn.hide();
                    }.bind(this),
                    o,
                    n,
                    i
                );
        }),
        (a.analytics = function () {}),
        n
    );
})(((n = e("PWX")) && n.__esModule ? n : {default: n}).default);
(o.default = a), (t.exports = o.default);
